//************************************************************************
//   PP5_7.java      Author:Duanzhixuan
//
//     设计一个程序模拟人和电脑进行石头，剪刀，布，的游戏。
//************************************************************************
import java.util.*;
import java.util.ArrayList;
public class pp5_7
{
public static void main(String[] args)
{int num1;
  String another="y",str;
Scanner scan = new Scanner(System.in);
 ArrayList<String> band = new ArrayList<String>();

band.add("Stone");
band.add("Clothing");
band.add("Scissor");
Random generator = new Random();
while (another.equalsIgnoreCase("y"))//allows y or Y
{num1 = generator.nextInt(3);
 System.out.println("Please enter Stone,Clothing or Scissor");
 str = scan.nextLine();
if (str.equalsIgnoreCase(band.get(num1)))
{System.out.println("计算机的选择:"+band.get(num1));
System.out.println("你们打平了");}
else
{if(str.equalsIgnoreCase("Stone")&&band.get(num1).equalsIgnoreCase("Scissor")||str.equalsIgnoreCase("Clothing")&&band.get(num1).equalsIgnoreCase("Stone")||str.equalsIgnoreCase("Scissor")&&band.get(num1).equalsIgnoreCase("Clothing"))
{System.out.println("计算机的选择:"+band.get(num1));
System.out.println("你赢了");}
else
{System.out.println("计算机的选择:"+band.get(num1));
System.out.println("你输了");}
}
System.out.println();
System.out.println("Again?(y/n)");
another = scan.nextLine();
}}}
